Optimal. Leaf size=54 \[ \frac {(A-B) x}{a}+\frac {B \sin (c+d x)}{a d}-\frac {(A-B) \sin (c+d x)}{a d (1+\cos (c+d x))} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.09, antiderivative size = 54, normalized size of antiderivative = 1.00, number of steps
used = 5, number of rules used = 5, integrand size = 29, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.172, Rules used = {3047, 3102, 12,
2814, 2727} \begin {gather*} -\frac {(A-B) \sin (c+d x)}{a d (\cos (c+d x)+1)}+\frac {x (A-B)}{a}+\frac {B \sin (c+d x)}{a d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 12
Rule 2727
Rule 2814
Rule 3047
Rule 3102
Rubi steps
\begin {align*} \int \frac {\cos (c+d x) (A+B \cos (c+d x))}{a+a \cos (c+d x)} \, dx &=\int \frac {A \cos (c+d x)+B \cos ^2(c+d x)}{a+a \cos (c+d x)} \, dx\\ &=\frac {B \sin (c+d x)}{a d}+\frac {\int \frac {a (A-B) \cos (c+d x)}{a+a \cos (c+d x)} \, dx}{a}\\ &=\frac {B \sin (c+d x)}{a d}+(A-B) \int \frac {\cos (c+d x)}{a+a \cos (c+d x)} \, dx\\ &=\frac {(A-B) x}{a}+\frac {B \sin (c+d x)}{a d}+(-A+B) \int \frac {1}{a+a \cos (c+d x)} \, dx\\ &=\frac {(A-B) x}{a}+\frac {B \sin (c+d x)}{a d}-\frac {(A-B) \sin (c+d x)}{d (a+a \cos (c+d x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(126\) vs. \(2(54)=108\).
time = 0.27, size = 126, normalized size = 2.33 \begin {gather*} \frac {\cos \left (\frac {1}{2} (c+d x)\right ) \sec \left (\frac {c}{2}\right ) \left (2 (A-B) d x \cos \left (\frac {d x}{2}\right )+2 (A-B) d x \cos \left (c+\frac {d x}{2}\right )-4 A \sin \left (\frac {d x}{2}\right )+5 B \sin \left (\frac {d x}{2}\right )+B \sin \left (c+\frac {d x}{2}\right )+B \sin \left (c+\frac {3 d x}{2}\right )+B \sin \left (2 c+\frac {3 d x}{2}\right )\right )}{2 a d (1+\cos (c+d x))} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.12, size = 76, normalized size = 1.41
method | result | size |
derivativedivides | \(\frac {-A \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+B \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+\frac {2 B \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )}+2 \left (A -B \right ) \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d a}\) | \(76\) |
default | \(\frac {-A \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+B \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+\frac {2 B \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )}+2 \left (A -B \right ) \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d a}\) | \(76\) |
risch | \(\frac {x A}{a}-\frac {B x}{a}-\frac {i {\mathrm e}^{i \left (d x +c \right )} B}{2 d a}+\frac {i {\mathrm e}^{-i \left (d x +c \right )} B}{2 d a}-\frac {2 i A}{d a \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}+\frac {2 i B}{d a \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}\) | \(99\) |
norman | \(\frac {\frac {\left (A -B \right ) x}{a}+\frac {\left (A -B \right ) x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a}-\frac {\left (A -3 B \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d a}-\frac {2 \left (A -2 B \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d a}-\frac {\left (A -B \right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d a}+\frac {2 \left (A -B \right ) x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{a}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{2}}\) | \(141\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 143 vs.
\(2 (54) = 108\).
time = 0.52, size = 143, normalized size = 2.65 \begin {gather*} -\frac {B {\left (\frac {2 \, \arctan \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1}\right )}{a} - \frac {2 \, \sin \left (d x + c\right )}{{\left (a + \frac {a \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}}\right )} {\left (\cos \left (d x + c\right ) + 1\right )}} - \frac {\sin \left (d x + c\right )}{a {\left (\cos \left (d x + c\right ) + 1\right )}}\right )} - A {\left (\frac {2 \, \arctan \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1}\right )}{a} - \frac {\sin \left (d x + c\right )}{a {\left (\cos \left (d x + c\right ) + 1\right )}}\right )}}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.34, size = 61, normalized size = 1.13 \begin {gather*} \frac {{\left (A - B\right )} d x \cos \left (d x + c\right ) + {\left (A - B\right )} d x + {\left (B \cos \left (d x + c\right ) - A + 2 \, B\right )} \sin \left (d x + c\right )}{a d \cos \left (d x + c\right ) + a d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 264 vs.
\(2 (39) = 78\).
time = 0.63, size = 264, normalized size = 4.89 \begin {gather*} \begin {cases} \frac {A d x \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )}}{a d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + a d} + \frac {A d x}{a d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + a d} - \frac {A \tan ^{3}{\left (\frac {c}{2} + \frac {d x}{2} \right )}}{a d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + a d} - \frac {A \tan {\left (\frac {c}{2} + \frac {d x}{2} \right )}}{a d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + a d} - \frac {B d x \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )}}{a d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + a d} - \frac {B d x}{a d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + a d} + \frac {B \tan ^{3}{\left (\frac {c}{2} + \frac {d x}{2} \right )}}{a d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + a d} + \frac {3 B \tan {\left (\frac {c}{2} + \frac {d x}{2} \right )}}{a d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + a d} & \text {for}\: d \neq 0 \\\frac {x \left (A + B \cos {\left (c \right )}\right ) \cos {\left (c \right )}}{a \cos {\left (c \right )} + a} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.42, size = 78, normalized size = 1.44 \begin {gather*} \frac {\frac {{\left (d x + c\right )} {\left (A - B\right )}}{a} - \frac {A \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{a} + \frac {2 \, B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )} a}}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 0.27, size = 65, normalized size = 1.20 \begin {gather*} \frac {x\,\left (A-B\right )}{a}+\frac {2\,B\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{d\,\left (a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+a\right )}-\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (A-B\right )}{a\,d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________